package cn.hxt.org.service.impl;

import cn.hxt.basic.service.impl.BaseServiceImpl;
import cn.hxt.basic.util.PageList;
import cn.hxt.org.domain.Employee;
import cn.hxt.org.mapper.EmployeeMapper;
import cn.hxt.org.query.EmployeeQuery;
import cn.hxt.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class EmployeeServiceImpl extends BaseServiceImpl<Employee> implements IEmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    /*
     * 新增一条数据z
     * @param employee
    @Override
    public void add(Employee employee) {
        employeeMapper.save(employee);
    }


     修改一条数据
     @param employee

    @Override
    public void update(Employee employee) {
        employeeMapper.update(employee);
    }


      删除一条数据
      @param id

    @Override
    public void delete(Long id) {
        employeeMapper.delete(id);
    }


      查询全部数据
      @return

    @Override
    public List<Employee> queryAll() {
        return employeeMapper.loagAll();
    }


     查询一条数据
     @param id
     @return

    @Override
    public Employee queryById(Long id) {
        return employeeMapper.loagById(id);
    }


    高级查询及分页查询
    @Override
    public PageList<Employee> queryPage(EmployeeQuery employeeQuery) {
        //获取条数
        Long cunt = employeeMapper.queryCunt(employeeQuery);
        //获取当前页数据1
        List<Employee> data = employeeMapper.queryData(employeeQuery);
        //自接还回对象
        return new PageList<Employee>(cunt,data);
    }

    批量删除
    @Override
    public void batchRemove(List<Long> ids) {
        employeeMapper.batchRemove(ids);
    }*/
}
